/*
 * array.h
 *
 *  Created on: Apr 21, 2011
 *      Author: mariano
 */

#ifndef ARRAY_H_
#define ARRAY_H_

typedef struct Array {
	void ** array;
	int count;
	int size;
} Array;

Array * newArray();

// Copy constructor, just to be sure
Array * copyArray(Array * other);

void deleteArray(Array * array);

void * getElementByIndex(Array * array, int index);

void forEach(Array * array, void(*function)(void *));

void add(Array * array, void * element);

Array * transformArray(Array * array, void *(*function)(void *));

void bubleSort(Array * array, int(*cmp)(void * e1, void * e2));

Array * getElementsByFunction(Array * array, int(*func)(void * e, void * arg),
		void * arg);

void deleteElementFromArray(Array * array, void * element, int(*cmp)(void * e1, void * e2));

void deleteRepetedElementsFormArray(Array * array, int(*cmp)(void * e1, void * e2));

int contains(Array * array,void * element,int(*cmp)(void * e1, void * e2));

#endif /* ARRAY_H_ */
